home *** CD-ROM | disk | FTP | other *** search
- // --------------------------------------------------------------------------------------------------------------
- //
- // MPackMUI V1.01 Hooks Module
- //
- // --------------------------------------------------------------------------------------------------------------
-
- #include "Hooks.h"
-
- // --------------------------------------------------------------------------------------------------------------
-
- __saveds LONG MenuAboutFunc(register __a0 struct Hook *hook, register __a2 APTR obj, register __a1 APTR param)
- {
- // Main Window: Project/About
-
- // Display About requester
-
- MUI_Request(App, Windows[WID_MAIN], 0, "About...", "_Ok", "\33c\33bMPackMUI V1.01\33n\n\nA MUI Interface for MPack V1.5\n\nToneMaster, 2000\n<tone_20@my-Deja.com>");
-
- return(0);
- } /* MenuAboutFunc() */
-
- // --------------------------------------------------------------------------------------------------------------
-
- __saveds LONG MenuMIMEPrefsFunc(register __a0 struct Hook *hook, register __a2 APTR obj, register __a1 APTR param)
- {
- // Main Window: Preferences/MIME Prefs...
-
- // Open MIME prefs window
-
- set(Windows[WID_MIMEPREFS], MUIA_Window_Open, TRUE);
-
- // Activate the first entry in the MIME list
-
- set(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIA_List_Active, MUIV_List_Active_Top);
-
- // Send main window to sleep whilst MIME prefs window is open
-
- set(Windows[WID_MAIN], MUIA_Window_Sleep, TRUE);
-
- return(0);
- } /* MenuPrefsFunc() */
-
- // --------------------------------------------------------------------------------------------------------------
-
- __saveds LONG MenuResetPrefsFunc(register __a0 struct Hook *hook, register __a2 APTR obj, register __a1 APTR param)
- {
- struct Node *tempnode;
- UWORD loop;
-
- // MIME Prefs Window: Edit/Reset to Defaults...
-
- // Send list to sleep
-
- set(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIA_List_Quiet, TRUE);
-
- // Clear list
-
- DoMethod(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIM_List_Clear);
-
- // Free old linked list
-
- FreeList(&MIMEList);
-
- // Build new linked list
-
- NewList(&MIMEList);
-
- loop = 0;
-
- while (DefaultMIMETypes[loop])
- {
- // Allocate node and name
-
- if (!(tempnode = AllocMem(sizeof(struct Node), 0)))
- {
- DoEasyReq("Couldn't allocate node");
- CleanUp();
- } /* if */
-
- if (!(tempnode->ln_Name = AllocMem(256, 0)))
- {
- DoEasyReq("Couldn't allocate node name");
- CleanUp();
- } /* if */
-
- // Copy name from array
-
- strcpy(tempnode->ln_Name, DefaultMIMETypes[loop]);
-
- // Add node to list
-
- AddTail(&MIMEList, tempnode);
-
- loop++;
- } /* while */
-
- // Update MIME Prefs list gadget
-
- if (!(IsListEmpty(&MIMEList)))
- {
- tempnode = MIMEList.lh_Head;
-
- while (tempnode->ln_Succ)
- {
- DoMethod(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIM_List_InsertSingle, tempnode->ln_Name);
-
- tempnode = tempnode->ln_Succ;
- } /* while */
- } /* if */
-
- set(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIA_List_Active, MUIV_List_Active_Top);
-
- // Wake MIME list gadget up
-
- set(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIA_List_Quiet, FALSE);
-
- return(0);
- } /* MenuResetPrefsFunc() */
-
- // --------------------------------------------------------------------------------------------------------------
-
- __saveds LONG MenuLastSavedPrefsFunc(register __a0 struct Hook *hook, register __a2 APTR obj, register __a1 APTR param)
- {
- BPTR prefsfile;
- char buffer[256];
- struct Node *tempnode;
-
- // MIME Prefs Window: Edit/Last Saved
-
- // Open the prefs file "ENVARC:MPackMUI.prefs" and load in the MIME list
-
- // Attempt to open the file
-
- if (!(prefsfile = Open("ENVARC:MPackMUI.prefs", MODE_OLDFILE)))
- {
- // No prefs file
-
- DoEasyReq("Couldn't find prefs");
-
- return(0);
- } /* if */
-
- // Send MIME list gadget to sleep
-
- set(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIA_List_Quiet, TRUE);
-
- // Clear the list
-
- DoMethod(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIM_List_Clear);
-
- // Free old linked list
-
- FreeList(&MIMEList);
-
- // Build new linked list
-
- NewList(&MIMEList);
-
- // Get each line of the file in turn
-
- while (FGets(prefsfile, buffer, 256))
- {
- // Allocate node and name
-
- if (!(tempnode = AllocMem(sizeof(struct Node), 0)))
- {
- DoEasyReq("Couldn't allocate node");
- CleanUp();
- } /* if */
-
- if (!(tempnode->ln_Name = AllocMem(256, 0)))
- {
- DoEasyReq("Couldn't allocate label");
- CleanUp();
- } /* if */
-
- // Remove newline
-
- buffer[strlen(buffer) - 1] = '\0';
-
- // Copy name to the node
-
- strcpy(tempnode->ln_Name, buffer);
-
- // Add node to list
-
- AddTail(&MIMEList, tempnode);
- } /* while */
-
- // Close the file
-
- Close(prefsfile);
-
- // Update MIME list gadget
-
- if (!(IsListEmpty(&MIMEList)))
- {
- tempnode = MIMEList.lh_Head;
-
- while (tempnode->ln_Succ)
- {
- DoMethod(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIM_List_InsertSingle, tempnode->ln_Name);
-
- tempnode = tempnode->ln_Succ;
- } /* while */
- } /* if */
-
- // Activate the first entry in the list gadget
-
- set(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIA_List_Active, MUIV_List_Active_Top);
-
- // Wake MIME list gadget up
-
- set(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIA_List_Quiet, FALSE);
-
- return(0);
- } /* MenuLastSavedFunc() */
-
- // --------------------------------------------------------------------------------------------------------------
-
- __saveds LONG MenuRestorePrefsFunc(register __a0 struct Hook *hook, register __a2 APTR obj, register __a1 APTR param)
- {
- // MIME Prefs Window: Edit/Restore
-
- // Restore the preferences we had before modification
-
- // Send MIME list gadget to sleep
-
- set(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIA_List_Quiet, TRUE);
-
- // Re-enter old labels into list
-
- DoMethod(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIM_List_Clear);
- DoMethod(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIM_List_Insert, MIMETypes, -1, MUIV_List_Insert_Bottom);
-
- // Rebuild the MIME types list from the MIME types array
-
- RebuildMIMEList();
-
- // Activate the first entry in the list gadget
-
- set(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIA_List_Active, MUIV_List_Active_Top);
-
- // Wake MIME list gadget up
-
- set(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIA_List_Quiet, FALSE);
-
- return(0);
- } /* MenuRestorePrefsFunc() */
-
- // --------------------------------------------------------------------------------------------------------------
-
- __saveds LONG MenuImportAwebPrefsFunc(register __a0 struct Hook *hook, register __a2 APTR obj, register __a1 APTR param)
- {
- BOOL skip;
- BPTR prefsfile;
- char buffer[256], mimepart[256], *error;
- struct Node *tempnode;
- UBYTE loop, loop2;
-
- // MIME Prefs Window: Edit/Import Aweb Prefs...
-
- // Import an AWeb 3 prefs file and extract MIME types
-
- // Ask for prefs file
-
- if (!(DoAslFileReq(buffer, "ENVARC:browser", FALSE)))
- {
- // User cancelled requester
-
- return(0);
- } /* if */
-
- // Attempt to open file
-
- if (!(prefsfile = Open(buffer, MODE_OLDFILE)))
- {
- // Can't open file
-
- DoEasyReq("Can't open prefs file");
-
- return(0);
- } /* if */
-
- // Check if this is a MIME prefs file
- //
- // We get the first line, and check that it reads "** Do not modify this by hand! **"
-
- // Get first line and remove the newline
-
- FGets(prefsfile, buffer, 256);
-
- buffer[strlen(buffer) - 1] = '\0';
-
- // Check line
-
- if (strcmp(buffer, "** Do not modify this file by hand! **") != 0)
- {
- // Wrong file format
-
- DoEasyReq("Not an AWeb 3 MIME prefs file");
-
- Close(prefsfile);
- return(0);
- } /* if */
-
- // Send list gadget to sleep
-
- set(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIA_List_Quiet, TRUE);
-
- // Clear list gadget
-
- DoMethod(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIM_List_Clear);
-
- // Free the old linked list
-
- FreeList(&MIMEList);
-
- // Build new linked list
-
- NewList(&MIMEList);
-
- // Search for first MIME descriptor line (begins MIMD)
-
- error = FGets(prefsfile, buffer, 256);
-
- while (buffer[0] != 'M' && buffer[1] != 'I' && error != NULL)
- {
- error = FGets(prefsfile, buffer, 256);
- } /* while */
-
- // Start getting data from file
-
- while (error != NULL)
- {
- // Allocate a new node
-
- if (!(tempnode = AllocMem(sizeof(struct Node), 0)))
- {
- // No memory available
-
- Printf("Out of memory\n");
-
- CleanUp();
- } /* if */
-
- if (!(tempnode->ln_Name = AllocMem(256, 0)))
- {
- // No memory available
-
- Printf("Out of memory\n");
-
- CleanUp();
- } /* if */
-
- // Get first part of MIME type
-
- skip = FALSE;
-
- switch (buffer[5])
- {
- case 'a':
- case 'A':
-
- if ((buffer[1] == 'p') || (buffer[1] == 'P'))
- {
- // Application/
-
- strcpy(tempnode->ln_Name, "application/");
- } /* if */
-
- else
- {
- // Audio/
-
- strcpy(tempnode->ln_Name, "audio/");
- } /* else */
-
- break;
-
- case 'i':
- case 'I':
-
- // Image/
-
- strcpy(tempnode->ln_Name, "image/");
-
- break;
-
- case 'v':
- case 'V':
-
- // Video/
-
- strcpy(tempnode->ln_Name, "video/");
-
- break;
-
- default:
-
- // Unknown type. Free current node and skip to next line
-
- skip = TRUE;
- } /* switch */
-
- // Check if we have a valid type
-
- if (skip)
- {
- // Bad MIME type (probably text/ or message/)
-
- // Free current node
-
- FreeMem(tempnode->ln_Name, 256);
- FreeMem(tempnode, sizeof(struct Node));
-
- // Reset skip condition
-
- skip = FALSE;
- } /* if */
-
- else
- {
- // Get second part of MIME type
-
- // Search forwards to character after the '/'
-
- loop = 5;
-
- while (buffer[loop] != '/')
- {
- loop++;
- } /* while */
-
- loop++;
-
- // Search forwards to ';' whilst extracting second part of MIME type
-
- loop2 = 0;
-
- while (buffer[loop] != ';')
- {
- mimepart[loop2] = tolower(buffer[loop]);
-
- loop++;
- loop2++;
- } /* while */
-
- // Terminate string
-
- mimepart[loop2] = '\0';
-
- // Check if we have a valid type
-
- if (mimepart[0] == '*')
- {
- // Bad MIME type (i.e. audio/*, image/* etc.)
-
- // Free current node
-
- FreeMem(tempnode->ln_Name, 256);
- FreeMem(tempnode, sizeof(struct Node));
- } /* if */
-
- else
- {
- // Add second part to main part
-
- strcat(tempnode->ln_Name, mimepart);
-
- // Link node into list
-
- AddTail(&MIMEList, tempnode);
- } /* else */
- } /* if */
-
- // Get next line of file
-
- error = FGets(prefsfile, buffer, 256);
- } /* while */
-
- // Close prefs file
-
- Close(prefsfile);
-
- // Insert list into list gadget
-
- if (!(IsListEmpty(&MIMEList)))
- {
- tempnode = MIMEList.lh_Head;
-
- while (tempnode->ln_Succ)
- {
- DoMethod(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIM_List_InsertSingle, tempnode->ln_Name);
-
- tempnode = tempnode->ln_Succ;
- } /* while */
- } /* if */
-
- // Set active entry
-
- set(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIA_List_Active, MUIV_List_Active_Top);
-
- // Wake list gadget up
-
- set(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIA_List_Quiet, FALSE);
-
- // All done
-
- return(0);
- } /* MenuImportAwebPrefsFunc() */
-
- // --------------------------------------------------------------------------------------------------------------
-
- __saveds LONG MenuImportVoyagerPrefsFunc(register __a0 struct Hook *hook, register __a2 APTR obj, register __a1 APTR param)
- {
- BOOL skip;
- BPTR prefsfile;
- char buffer[256], mimepart[256];
- struct Node *tempnode;
- UBYTE loop, loop2;
-
- // MIME Prefs Window: Edit/Import Voyager Prefs...
-
- // Import a Voyager 3 MIME prefs file and extract MIME types
-
- // Ask for prefs file
-
- if (!(DoAslFileReq(buffer, "ENVARC:MIME.Prefs", FALSE)))
- {
- // User cancelled requester
-
- return(0);
- } /* if */
-
- // Attempt to open file
-
- if (!(prefsfile = Open(buffer, MODE_OLDFILE)))
- {
- // Can't open file
-
- DoEasyReq("Can't open prefs file");
-
- return(0);
- } /* if */
-
- // Check if this is a MIME prefs file
- //
- // We skip the first line, and check that the next line reads "; MIME Preferences"
-
- // Skip first line
-
- FGets(prefsfile, buffer, 256);
-
- // Get next line and remove the newline
-
- FGets(prefsfile, buffer, 256);
-
- buffer[strlen(buffer) - 1] = '\0';
-
- // Check line
-
- if (strcmp(buffer, "; MIME Preferences") != 0)
- {
- // Wrong file format
-
- DoEasyReq("Not a Voyager 3 MIME prefs file");
-
- Close(prefsfile);
- return(0);
- } /* if */
-
- // Send list gadget to sleep
-
- set(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIA_List_Quiet, TRUE);
-
- // Clear list gadget
-
- DoMethod(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIM_List_Clear);
-
- // Free old linked list
-
- FreeList(&MIMEList);
-
- // Build new linked list
-
- NewList(&MIMEList);
-
- // Skip 3 more lines to beginning of data
-
- FGets(prefsfile, buffer, 256);
- FGets(prefsfile, buffer, 256);
- FGets(prefsfile, buffer, 256);
-
- // Now start getting data from file
-
- FGets(prefsfile, buffer, 256);
-
- while (buffer[0] != ';')
- {
- // Allocate a new node
-
- if (!(tempnode = AllocMem(sizeof(struct Node), 0)))
- {
- // No memory available
-
- Printf("Out of memory\n");
-
- CleanUp();
- } /* if */
-
- if (!(tempnode->ln_Name = AllocMem(256, 0)))
- {
- // No memory available
-
- Printf("Out of memory\n");
-
- CleanUp();
- } /* if */
-
- // Get first part of MIME type
-
- skip = FALSE;
-
- switch (buffer[0])
- {
- case 'a':
- case 'A':
-
- if ((buffer[1] == 'p') || (buffer[1] == 'P'))
- {
- // Application/
-
- strcpy(tempnode->ln_Name, "application/");
- } /* if */
-
- else
- {
- // Audio/
-
- strcpy(tempnode->ln_Name, "audio/");
- } /* else */
-
- break;
-
- case 'i':
- case 'I':
-
- // Image/
-
- strcpy(tempnode->ln_Name, "image/");
-
- break;
-
- case 'v':
- case 'V':
-
- // Video/
-
- strcpy(tempnode->ln_Name, "video/");
-
- break;
-
- default:
-
- // Unknown type. Free current node and skip to next line
-
- skip = TRUE;
- } /* switch */
-
- // Check if we have a valid type
-
- if (skip)
- {
- // Bad MIME type (probably text/ or message/)
-
- // Free current node
-
- FreeMem(tempnode->ln_Name, 256);
- FreeMem(tempnode, sizeof(struct Node));
-
- // Reset skip condition
-
- skip = FALSE;
- } /* if */
-
- else
- {
- // Get second part of MIME type
-
- // Search forwards to character after the '/'
-
- loop = 0;
-
- while (buffer[loop] != '/')
- {
- loop++;
- } /* while */
-
- loop++;
-
- // Search forwards to ','
-
- loop2 = loop;
-
- while (buffer[loop2] != ',')
- {
- loop2++;
- } /* while */
-
- // Extract second part of MIME type
-
- strncpy(mimepart, &buffer[loop], loop2 - loop);
-
- mimepart[loop2 - loop] = '\0';
-
- // Check if we have a valid type
-
- if (mimepart[0] == '*')
- {
- // Bad MIME type (i.e. audio/*, image/* etc.)
-
- // Free current node
-
- FreeMem(tempnode->ln_Name, 256);
- FreeMem(tempnode, sizeof(struct Node));
- } /* if */
-
- else
- {
- // Add second part to main part
-
- strcat(tempnode->ln_Name, mimepart);
-
- // Link node into list
-
- AddTail(&MIMEList, tempnode);
- } /* else */
- } /* if */
-
- // Get next line of file
-
- FGets(prefsfile, buffer, 256);
- } /* while */
-
- // Close prefs file
-
- Close(prefsfile);
-
- // Insert list into list gadget
-
- if (!(IsListEmpty(&MIMEList)))
- {
- tempnode = MIMEList.lh_Head;
-
- while (tempnode->ln_Succ)
- {
- DoMethod(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIM_List_InsertSingle, tempnode->ln_Name);
-
- tempnode = tempnode->ln_Succ;
- } /* while */
- } /* if */
-
- // Set active entry
-
- set(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIA_List_Active, MUIV_List_Active_Top);
-
- // Wake list gadget up
-
- set(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIA_List_Quiet, FALSE);
-
- // All done
-
- return(0);
- } /* MenuImportVoyagerPrefsFunc() */
-
- // --------------------------------------------------------------------------------------------------------------
-
- __saveds LONG Page1InputPopFunc(register __a0 struct Hook *hook, register __a2 APTR obj, register __a1 APTR param)
- {
- char buffer[256];
- LONG *path;
-
- // Main Window: Page 1 / Input File Pop Gadget
-
- // Get input file and store in the Input String
-
- // Send window to sleep
-
- set(Windows[WID_MAIN], MUIA_Window_Sleep, TRUE);
-
- // Get old path
-
- get(Gadgets[GID_INPUT_STRING_P1], MUIA_String_Contents, &path);
-
- // Ask for the file
-
- if (DoAslFileReq(buffer, (char *)path, FALSE))
- {
- // Store path in string
-
- set(Gadgets[GID_INPUT_STRING_P1], MUIA_String_Contents, buffer);
- } /* if */
-
- // Wake window up
-
- set(Windows[WID_MAIN], MUIA_Window_Sleep, FALSE);
-
- return(0);
- } /* Page1InputPopFunc() */
-
- // --------------------------------------------------------------------------------------------------------------
-
- __saveds LONG Page1OutputPopFunc(register __a0 struct Hook *hook, register __a2 APTR obj, register __a1 APTR param)
- {
- char buffer[256];
- LONG *path;
-
- // Main Window: Page 1 / Output File Pop Gadget
-
- // Get output file and store in the Output String
-
- // Send window to sleep
-
- set(Windows[WID_MAIN], MUIA_Window_Sleep, TRUE);
-
- // Get old path
-
- get(Gadgets[GID_OUTPUT_STRING_P1], MUIA_String_Contents, &path);
-
- // Ask for the file
-
- if (DoAslFileReq(buffer, (char *)path, TRUE))
- {
- // Store path in string
-
- set(Gadgets[GID_OUTPUT_STRING_P1], MUIA_String_Contents, buffer);
- } /* if */
-
- // Wake window up
-
- set(Windows[WID_MAIN], MUIA_Window_Sleep, FALSE);
-
- return(0);
- } /* Page1OutputPopFunc() */
-
- // --------------------------------------------------------------------------------------------------------------
-
- __saveds LONG Page1DescPopFunc(register __a0 struct Hook *hook, register __a2 APTR obj, register __a1 APTR param)
- {
- char buffer[256];
- LONG *path;
-
- // Main Window: Page 1 / Description File Pop Gadget
-
- // Get description file and store in the Description String
-
- // Send window to sleep
-
- set(Windows[WID_MAIN], MUIA_Window_Sleep, TRUE);
-
- // Get old path
-
- get(Gadgets[GID_DESC_STRING_P1], MUIA_String_Contents, &path);
-
- // Ask for the file
-
- if (DoAslFileReq(buffer, (char *)path, FALSE))
- {
- // Store path in string
-
- set(Gadgets[GID_DESC_STRING_P1], MUIA_String_Contents, buffer);
- } /* if */
-
- // Wake window up
-
- set(Windows[WID_MAIN], MUIA_Window_Sleep, FALSE);
-
- return(0);
- } /* Page1DescPopFunc() */
-
- // --------------------------------------------------------------------------------------------------------------
-
- __saveds LONG Page1DescCheckFunc(register __a0 struct Hook *hook, register __a2 APTR obj, register __a1 APTR param)
- {
- LONG *state;
-
- // Main Window: Page 1 / Description Check Gadget
-
- // Enable/Disable Description String & Pop
-
- get(Gadgets[GID_DESC_CHECK_P1], MUIA_Selected, &state);
-
- if (state)
- {
- set(Gadgets[GID_DESC_STRING_P1], MUIA_Disabled, FALSE);
- set(Gadgets[GID_DESC_POP_P1], MUIA_Disabled, FALSE);
- } /* if */
-
- else
- {
- set(Gadgets[GID_DESC_STRING_P1], MUIA_Disabled, TRUE);
- set(Gadgets[GID_DESC_POP_P1], MUIA_Disabled, TRUE);
- } /* else */
-
- return(0);
- } /* Page1DescCheckFunc() */
-
- // --------------------------------------------------------------------------------------------------------------
-
- __saveds LONG Page1MaxCheckFunc(register __a0 struct Hook *hook, register __a2 APTR obj, register __a1 APTR param)
- {
- LONG *state;
-
- // Main Window: Page 1 / Maximum Size Check Gadget
-
- // Enable/Disable Maximum Size String
-
- get(Gadgets[GID_MAX_CHECK_P1], MUIA_Selected, &state);
-
- if (state)
- {
- set(Gadgets[GID_MAX_STRING_P1], MUIA_Disabled, FALSE);
- } /* if */
-
- else
- {
- set(Gadgets[GID_MAX_STRING_P1], MUIA_Disabled, TRUE);
- } /* else */
-
- return(0);
- } /* Page1MaxCheckFunc() */
-
- // --------------------------------------------------------------------------------------------------------------
-
- __saveds LONG Page1EncodeButtonFunc(register __a0 struct Hook *hook, register __a2 APTR obj, register __a1 APTR param)
- {
- // Main Window: Page 1 / Encode Button Gadget
-
- // Call encoding routine
-
- Encode2File();
-
- return(0);
- } /* Page1EncodeButtonFunc() */
-
- // --------------------------------------------------------------------------------------------------------------
-
- __saveds LONG Page2InputPopFunc(register __a0 struct Hook *hook, register __a2 APTR obj, register __a1 APTR param)
- {
- char buffer[256];
- LONG *path;
-
- // Main Window: Page 2 / Input File Pop Gadget
-
- // Get input file and store in the Input String
-
- // Send window to sleep
-
- set(Windows[WID_MAIN], MUIA_Window_Sleep, TRUE);
-
- // Get old path
-
- get(Gadgets[GID_INPUT_STRING_P2], MUIA_String_Contents, &path);
-
- // Ask for the file
-
- if (DoAslFileReq(buffer, (char *)path, FALSE))
- {
- // Store path in string
-
- set(Gadgets[GID_INPUT_STRING_P2], MUIA_String_Contents, buffer);
- } /* if */
-
- // Wake window up
-
- set(Windows[WID_MAIN], MUIA_Window_Sleep, FALSE);
-
- return(0);
- } /* Page2InputPopFunc() */
-
- // --------------------------------------------------------------------------------------------------------------
-
- __saveds LONG Page2OutputPopFunc(register __a0 struct Hook *hook, register __a2 APTR obj, register __a1 APTR param)
- {
- char buffer[256];
- LONG *path;
-
- // Main Window: Page 2 / Output Directory Pop Gadget
-
- // Get output directory and store in Output String
-
- // Send window to sleep
-
- set(Windows[WID_MAIN], MUIA_Window_Sleep, TRUE);
-
- // Get old path
-
- get(Gadgets[GID_OUTPUT_STRING_P2], MUIA_String_Contents, &path);
-
- // Ask for directory
-
- if (DoAslDirReq(buffer, (char *)path))
- {
- // Store path in string
-
- set(Gadgets[GID_OUTPUT_STRING_P2], MUIA_String_Contents, buffer);
- } /* if */
-
- // Wake window up
-
- set(Windows[WID_MAIN], MUIA_Window_Sleep, FALSE);
-
- return(0);
- } /* Page2OutputPopFunc() */
-
- // --------------------------------------------------------------------------------------------------------------
-
- __saveds LONG Page2DecodeButtonFunc(register __a0 struct Hook *hook, register __a2 APTR obj, register __a1 APTR param)
- {
- // Main Window: Page 2 / Decode Button Gadget
-
- // Call decoding routine
-
- Decode2File();
-
- return(0);
- } /* Page2DecodeButtonFunc() */
-
- // --------------------------------------------------------------------------------------------------------------
-
- __saveds LONG Page3InputPopFunc(register __a0 struct Hook *hook, register __a2 APTR obj, register __a1 APTR param)
- {
- char buffer[256];
- LONG *path;
-
- // Main Window: Page 3 / Input File Pop Gadget
-
- // Get input file and store in the Input String
-
- // Send window to sleep
-
- set(Windows[WID_MAIN], MUIA_Window_Sleep, TRUE);
-
- // Get old path
-
- get(Gadgets[GID_INPUT_STRING_P3], MUIA_String_Contents, &path);
-
- // Ask for the file
-
- if (DoAslFileReq(buffer, (char *)path, FALSE))
- {
- // Store path in string
-
- set(Gadgets[GID_INPUT_STRING_P3], MUIA_String_Contents, buffer);
- } /* if */
-
- // Wake window up
-
- set(Windows[WID_MAIN], MUIA_Window_Sleep, FALSE);
-
- return(0);
- } /* Page3InputPopFunc() */
-
- // --------------------------------------------------------------------------------------------------------------
-
- __saveds LONG Page3DescPopFunc(register __a0 struct Hook *hook, register __a2 APTR obj, register __a1 APTR param)
- {
- char buffer[256];
- LONG *path;
-
- // Main Window: Page 3 / Description File Pop Gadget
-
- // Get description file and store in the Description String
-
- // Send window to sleep
-
- set(Windows[WID_MAIN], MUIA_Window_Sleep, TRUE);
-
- // Get old path
-
- get(Gadgets[GID_DESC_STRING_P3], MUIA_String_Contents, &path);
-
- // Ask for the file
-
- if (DoAslFileReq(buffer, (char *)path, FALSE))
- {
- // Store path in string
-
- set(Gadgets[GID_DESC_STRING_P3], MUIA_String_Contents, buffer);
- } /* if */
-
- // Wake window up
-
- set(Windows[WID_MAIN], MUIA_Window_Sleep, FALSE);
-
- return(0);
- } /* Page3DescPopFunc() */
-
- // --------------------------------------------------------------------------------------------------------------
-
- __saveds LONG Page3DescCheckFunc(register __a0 struct Hook *hook, register __a2 APTR obj, register __a1 APTR param)
- {
- LONG *state;
-
- // Main Window: Page 3 / Description Check Gadget
-
- // Enable/Disable Description String & Pop
-
- get(Gadgets[GID_DESC_CHECK_P3], MUIA_Selected, &state);
-
- if (state)
- {
- set(Gadgets[GID_DESC_STRING_P3], MUIA_Disabled, FALSE);
- set(Gadgets[GID_DESC_POP_P3], MUIA_Disabled, FALSE);
- } /* if */
-
- else
- {
- set(Gadgets[GID_DESC_STRING_P3], MUIA_Disabled, TRUE);
- set(Gadgets[GID_DESC_POP_P3], MUIA_Disabled, TRUE);
- } /* else */
-
- return(0);
- } /* Page3DescCheckFunc() */
-
- // --------------------------------------------------------------------------------------------------------------
-
- __saveds LONG Page3MaxCheckFunc(register __a0 struct Hook *hook, register __a2 APTR obj, register __a1 APTR param)
- {
- LONG *state;
-
- // Main Window: Page 3 / Maximum Size Check Gadget
-
- // Enable/Disable Maximum Size String
-
- get(Gadgets[GID_MAX_CHECK_P3], MUIA_Selected, &state);
-
- if (state)
- {
- set(Gadgets[GID_MAX_STRING_P3], MUIA_Disabled, FALSE);
- } /* if */
-
- else
- {
- set(Gadgets[GID_MAX_STRING_P3], MUIA_Disabled, TRUE);
- } /* else */
-
- return(0);
- } /* Page3MaxCheckFunc() */
-
- // --------------------------------------------------------------------------------------------------------------
-
- __saveds LONG Page3EncodeButtonFunc(register __a0 struct Hook *hook, register __a2 APTR obj, register __a1 APTR param)
- {
- // Main Window: Page 3 / Encode Button Gadget
-
- // Call encoding routine
-
- Encode2Mail();
-
- return(0);
- } /* Page3EncodeButtonFunc() */
-
- // --------------------------------------------------------------------------------------------------------------
-
- __saveds LONG Page4InputPopFunc(register __a0 struct Hook *hook, register __a2 APTR obj, register __a1 APTR param)
- {
- char buffer[256];
- LONG *path;
-
- // Main Window: Page 4 - Input File Pop Gadget
-
- // Get input file and store in the Input String
-
- // Send window to sleep
-
- set(Windows[WID_MAIN], MUIA_Window_Sleep, TRUE);
-
- // Get old path
-
- get(Gadgets[GID_INPUT_STRING_P4], MUIA_String_Contents, &path);
-
- // Ask for the file
-
- if (DoAslFileReq(buffer, (char *)path, FALSE))
- {
- // Store path in string
-
- set(Gadgets[GID_INPUT_STRING_P4], MUIA_String_Contents, buffer);
- } /* if */
-
- // Wake window up
-
- set(Windows[WID_MAIN], MUIA_Window_Sleep, FALSE);
-
- return(0);
- } /* Page4InputPopFunc() */
-
- // --------------------------------------------------------------------------------------------------------------
-
- __saveds LONG Page4DescPopFunc(register __a0 struct Hook *hook, register __a2 APTR obj, register __a1 APTR param)
- {
- char buffer[256];
- LONG *path;
-
- // Main Window: Page 4 / Description File Pop Gadget
-
- // Get description file and store in the Description String
-
- // Send window to sleep
-
- set(Windows[WID_MAIN], MUIA_Window_Sleep, TRUE);
-
- // Get old path
-
- get(Gadgets[GID_DESC_STRING_P4], MUIA_String_Contents, &path);
-
- // Ask for the file
-
- if (DoAslFileReq(buffer, (char *)path, FALSE))
- {
- // Store path in string
-
- set(Gadgets[GID_DESC_STRING_P4], MUIA_String_Contents, buffer);
- } /* if */
-
- // Wake window up
-
- set(Windows[WID_MAIN], MUIA_Window_Sleep, FALSE);
-
- return(0);
- } /* Page4DescPopFunc() */
-
- // --------------------------------------------------------------------------------------------------------------
-
- __saveds LONG Page4DescCheckFunc(register __a0 struct Hook *hook, register __a2 APTR obj, register __a1 APTR param)
- {
- LONG *state;
-
- // Main Window: Page 4 / Description Check Gadget
-
- // Enable/Disable Description String & Pop
-
- get(Gadgets[GID_DESC_CHECK_P4], MUIA_Selected, &state);
-
- if (state)
- {
- set(Gadgets[GID_DESC_STRING_P4], MUIA_Disabled, FALSE);
- set(Gadgets[GID_DESC_POP_P4], MUIA_Disabled, FALSE);
- } /* if */
-
- else
- {
- set(Gadgets[GID_DESC_STRING_P4], MUIA_Disabled, TRUE);
- set(Gadgets[GID_DESC_POP_P4], MUIA_Disabled, TRUE);
- } /* else */
-
- return(0);
- } /* Page4DescCheckFunc() */
-
- // --------------------------------------------------------------------------------------------------------------
-
- __saveds LONG Page4MaxCheckFunc(register __a0 struct Hook *hook, register __a2 APTR obj, register __a1 APTR param)
- {
- LONG *state;
-
- // Main Window: Page 4 / Maximum Size Check Gadget
-
- // Enable/Disable Maximum Size String
-
- get(Gadgets[GID_MAX_CHECK_P4], MUIA_Selected, &state);
-
- if (state)
- {
- set(Gadgets[GID_MAX_STRING_P4], MUIA_Disabled, FALSE);
- } /* if */
-
- else
- {
- set(Gadgets[GID_MAX_STRING_P4], MUIA_Disabled, TRUE);
- } /* else */
-
- return(0);
- } /* Page4MaxCheckFunc() */
-
- // --------------------------------------------------------------------------------------------------------------
-
- __saveds LONG Page4EncodeButtonFunc(register __a0 struct Hook *hook, register __a2 APTR obj, register __a1 APTR param)
- {
- // Main Window: Page 4 / Encode Button Gadget
-
- // Call encoding routine
-
- Encode2NG();
-
- return(0);
- } /* Page4EncodeButtonFunc() */
-
- // --------------------------------------------------------------------------------------------------------------
-
- __saveds LONG PrefsMIMEListFunc(register __a0 struct Hook *hook, register __a2 APTR obj, register __a1 APTR param)
- {
- char *entry;
- UBYTE loop;
-
- // MIME Prefs Window: MIME List Gadget
-
- // Grab type from list
-
- DoMethod(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &entry);
-
- if (entry)
- {
- // Set cycle gadget part WITHOUT notification (which would call PrefsMIMECycleFunc() )
-
- switch (entry[0])
- {
- case 'a':
-
- if (entry[1] == 'p')
- {
- // Application/
-
- nnset(Gadgets[GID_MIMETYPES_CYCLE_PREFS], MUIA_Cycle_Active, 0);
- } /* if */
-
- else
- {
- // Audio/
-
- nnset(Gadgets[GID_MIMETYPES_CYCLE_PREFS], MUIA_Cycle_Active, 1);
- } /* else */
-
- break;
-
- case 'i':
-
- // Image/
-
- nnset(Gadgets[GID_MIMETYPES_CYCLE_PREFS], MUIA_Cycle_Active, 2);
-
- break;
-
- case 'v':
-
- // Video/
-
- nnset(Gadgets[GID_MIMETYPES_CYCLE_PREFS], MUIA_Cycle_Active, 4);
-
- break;
-
- } /* select */
-
- // Set string part
-
- loop = 0;
-
- while (entry[loop] != '/')
- {
- loop++;
- } /* if */
-
- loop++;
-
- set(Gadgets[GID_MIMETYPES_STRING_PREFS], MUIA_String_Contents, &entry[loop]);
- } /* if */
-
- return(0);
- } /* PrefsMIMEListFunc() */
-
- // --------------------------------------------------------------------------------------------------------------
-
- __saveds LONG PrefsMIMEUpdateFunc(register __a0 struct Hook *hook, register __a2 APTR obj, register __a1 APTR param)
- {
- char newentry[256], *stringpart;
- LONG entrynum;
- struct Node *tempnode;
- UWORD loop;
-
- // MIME Prefs Window: MIME Cycle / String Gadget
-
- // Adjust entry in list
-
- get(Gadgets[GID_MIMETYPES_CYCLE_PREFS], MUIA_Cycle_Active, &entrynum);
-
- // Get cycle part
-
- switch(entrynum)
- {
- case 0:
-
- strcpy(newentry, "application/");
-
- break;
-
- case 1:
-
- strcpy(newentry, "audio/");
-
- break;
-
- case 2:
-
- strcpy(newentry, "image/");
-
- break;
-
- case 3:
-
- strcpy(newentry, "audio/");
-
- break;
-
- } /* switch */
-
- // Get string part
-
- get(Gadgets[GID_MIMETYPES_STRING_PREFS], MUIA_String_Contents, &stringpart);
-
- // Build new type
-
- strcat(newentry, stringpart);
-
- // Send list to sleep
-
- set(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIA_List_Quiet, TRUE);
-
- // Modify linked list and update list gadget
-
- // Find entry in linked list corresponding to currently active entry in list gadget
-
- get(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIA_List_Active, &entrynum);
-
- if (!(IsListEmpty(&MIMEList)))
- {
- tempnode = MIMEList.lh_Head;
-
- for (loop = 0; loop < entrynum; loop++)
- {
- // Go to next node in linked list
-
- tempnode = tempnode->ln_Succ;
- } /* for */
- } /* if */
-
- // Update linked list
-
- strcpy(tempnode->ln_Name, newentry);
-
- // Update list gadget
-
- DoMethod(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIM_List_InsertSingle, tempnode->ln_Name, entrynum);
- DoMethod(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIM_List_Remove, MUIV_List_Remove_Active);
-
- set(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIA_List_Active, entrynum);
-
- // Wake up list
-
- set(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIA_List_Quiet, FALSE);
-
- return(0);
- } /* PrefsMIMEUpdateFunc() */
-
- // --------------------------------------------------------------------------------------------------------------
-
- __saveds LONG PrefsAddButtonFunc(register __a0 struct Hook *hook, register __a2 APTR obj, register __a1 APTR param)
- {
- struct Node *tempnode;
-
- // MIME Prefs Window: Add Button Gadget
-
- // Add a new item to the list
-
- // First, add a node to the linked list
-
- if (!(tempnode = AllocMem(sizeof(struct Node), 0)))
- {
- DoEasyReq("Couldn't allocate node");
- CleanUp();
- } /* if */
-
- if (!(tempnode->ln_Name = AllocMem(256, 0)))
- {
- DoEasyReq("Couldn't allocate label");
- CleanUp();
- } /* if */
-
- strcpy(tempnode->ln_Name, "application/");
-
- AddTail(&MIMEList, tempnode);
-
- // Now update the list
-
- DoMethod(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIM_List_InsertSingle, tempnode->ln_Name, MUIV_List_Insert_Bottom);
-
- set(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIA_List_Active, MUIV_List_Active_Bottom);
-
- return(0);
- } /* PrefsAddButtonFunc() */
-
- // --------------------------------------------------------------------------------------------------------------
-
- __saveds LONG PrefsRemoveButtonFunc(register __a0 struct Hook *hook, register __a2 APTR obj, register __a1 APTR param)
- {
- LONG entrynum;
- struct Node *tempnode;
- UWORD loop;
-
- // MIME Prefs Window: Remove Button Gadget
-
- // Remove an item from the list
-
- // First, find the node in the linked list
-
- get(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIA_List_Active, &entrynum);
-
- if (entrynum == MUIV_List_Active_Off)
- {
- // No entry selected.
-
- return(0);
- } /* if */
-
- if (!(IsListEmpty(&MIMEList)))
- {
- tempnode = MIMEList.lh_Head;
-
- for (loop = 0; loop < entrynum; loop++)
- {
- // Go to next node in linked list
-
- tempnode = tempnode->ln_Succ;
- } /* for */
- } /* if */
-
- // Remove the entry from the list gadget
-
- DoMethod(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIM_List_Remove, MUIV_List_Remove_Active);
-
- // Remove the node from the linked list
-
- Remove(tempnode);
-
- FreeMem(tempnode->ln_Name, 256);
- FreeMem(tempnode, sizeof(struct Node));
-
- return(0);
- } /* PrefsRemoveButtonFunc() */
-
- // --------------------------------------------------------------------------------------------------------------
-
- __saveds LONG PrefsCopyButtonFunc(register __a0 struct Hook *hook, register __a2 APTR obj, register __a1 APTR param)
- {
- char *entry;
- LONG entrynum;
- struct Node *tempnode;
-
- // MIME Prefs Window: Copy Button Gadget
-
- // Duplicate an entry in the list
-
- // Get the active entry from the list
-
- get(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIA_List_Active, &entrynum);
-
- if (entrynum == MUIV_List_Active_Off)
- {
- // No entry selected.
-
- return(0);
- } /* if */
-
- DoMethod(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIM_List_GetEntry, entrynum, &entry);
-
- // Add a new node to the linked list
-
- if (!(tempnode = AllocMem(sizeof(struct Node), 0)))
- {
- DoEasyReq("Couldn't allocate node");
- CleanUp();
- } /* if */
-
- if (!(tempnode->ln_Name = AllocMem(256, 0)))
- {
- DoEasyReq("Couldn't allocate label");
- CleanUp();
- } /* if */
-
- strcpy(tempnode->ln_Name, entry);
-
- AddTail(&MIMEList, tempnode);
-
- // Add the entry to the list gadget
-
- DoMethod(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIM_List_InsertSingle, tempnode->ln_Name, MUIV_List_Insert_Bottom);
-
- set(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIA_List_Active, MUIV_List_Active_Bottom);
-
- return(0);
- } /* PrefsCopyButtonFunc() */
-
- // --------------------------------------------------------------------------------------------------------------
-
- __saveds LONG PrefsSortButtonFunc(register __a0 struct Hook *hook, register __a2 APTR obj, register __a1 APTR param)
- {
- char *entry;
- LONG numentries;
- struct Node *swapnode1, *swapnode2, *sw1pred;
- UWORD loop;
-
- // MIME Prefs Window: Sort Button Gadget
-
- // Sort the list
-
- DoMethod(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIM_List_Sort);
-
- // Sort the linked list
-
- get(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIA_List_Entries, &numentries);
-
- swapnode1 = MIMEList.lh_Head;
-
- for (loop = 0; loop < numentries; loop++)
- {
- DoMethod(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIM_List_GetEntry, loop, &entry);
-
- if (!(swapnode2 = FindName(&MIMEList, entry)))
- {
- // Something went wrong
-
- DoEasyReq("?");
- CleanUp();
- } /* if */
-
- if (swapnode1 != swapnode2)
- {
- // Swap nodes
-
- sw1pred = swapnode1->ln_Pred;
-
- // Remove first node and insert after second node
-
- Remove(swapnode1);
-
- Insert(&MIMEList, swapnode1, swapnode2);
-
- // Remove second node and insert after first node's original position
-
- Remove(swapnode2);
-
- if (loop == 0)
- {
- // Insert at head of list
-
- AddHead(&MIMEList, swapnode2);
- } /* if */
-
- else
- {
- // Insert after first node's original position
-
- Insert(&MIMEList, swapnode2, sw1pred);
- } /* else */
-
- swapnode1 = swapnode2->ln_Succ;
- } /* if */
-
- else
- {
- swapnode1 = swapnode1->ln_Succ;
- } /* else */
- } /* for */
-
- return(0);
- } /* PrefsSortButtonFunc() */
-
- // --------------------------------------------------------------------------------------------------------------
-
- __saveds LONG PrefsSaveButtonFunc(register __a0 struct Hook *hook, register __a2 APTR obj, register __a1 APTR param)
- {
- // MIME Prefs Window: Save Button Gadget
-
- // Save the current preferences
-
- // Close the window and rebuild the MIME types list
-
- set(Windows[WID_MIMEPREFS], MUIA_Window_Open, FALSE);
-
- DoMethod(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIM_List_Clear);
-
- RebuildMIMETypes();
-
- // Update the MIME Prefs list gadget
-
- DoMethod(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIM_List_Insert, MIMETypes, -1, MUIV_List_Insert_Bottom);
-
- // Update the cycle gadgets
-
- if (DoMethod(Gadgets[GID_TYPE_GROUP_P1], MUIM_Group_InitChange))
- {
- DoMethod(Gadgets[GID_TYPE_GROUP_P1], OM_REMMEMBER, Gadgets[GID_TYPE_CYCLE_P1]);
- MUI_DisposeObject(Gadgets[GID_TYPE_CYCLE_P1]);
-
- DoMethod(Gadgets[GID_TYPE_GROUP_P1], OM_ADDMEMBER, Gadgets[GID_TYPE_CYCLE_P1] = CycleObject, MUIA_Cycle_Entries, MIMETypes, End);
-
- DoMethod(Gadgets[GID_TYPE_GROUP_P1], MUIM_Group_ExitChange);
- } /* if */
-
- if (DoMethod(Gadgets[GID_TYPE_GROUP_P3], MUIM_Group_InitChange))
- {
- DoMethod(Gadgets[GID_TYPE_GROUP_P3], OM_REMMEMBER, Gadgets[GID_TYPE_CYCLE_P3]);
- MUI_DisposeObject(Gadgets[GID_TYPE_CYCLE_P3]);
-
- DoMethod(Gadgets[GID_TYPE_GROUP_P3], OM_ADDMEMBER, Gadgets[GID_TYPE_CYCLE_P3] = CycleObject, MUIA_Cycle_Entries, MIMETypes, End);
-
- DoMethod(Gadgets[GID_TYPE_GROUP_P3], MUIM_Group_ExitChange);
- } /* if */
-
- if (DoMethod(Gadgets[GID_TYPE_GROUP_P4], MUIM_Group_InitChange))
- {
- DoMethod(Gadgets[GID_TYPE_GROUP_P4], OM_REMMEMBER, Gadgets[GID_TYPE_CYCLE_P4]);
- MUI_DisposeObject(Gadgets[GID_TYPE_CYCLE_P4]);
-
- DoMethod(Gadgets[GID_TYPE_GROUP_P4], OM_ADDMEMBER, Gadgets[GID_TYPE_CYCLE_P4] = CycleObject, MUIA_Cycle_Entries, MIMETypes, End);
-
- DoMethod(Gadgets[GID_TYPE_GROUP_P4], MUIM_Group_ExitChange);
- } /* if */
-
- // Save the prefs to ENV:MPackMUI.prefs and ENVARC:MPackMUI.prefs
-
- SavePrefs("ENV:MPackMUI.prefs");
- SavePrefs("ENVARC:MPackMUI.prefs");
-
- // Wake up the main window
-
- set(Windows[WID_MAIN], MUIA_Window_Sleep, FALSE);
-
- return(0);
- } /* PrefsSaveButtonFunc() */
-
- // --------------------------------------------------------------------------------------------------------------
-
- __saveds LONG PrefsUseButtonFunc(register __a0 struct Hook *hook, register __a2 APTR obj, register __a1 APTR param)
- {
- // MIME Prefs Window: Use Button Gadget
-
- // Use the current preferences
-
- // Close the window and rebuild the MIME types list
-
- set(Windows[WID_MIMEPREFS], MUIA_Window_Open, FALSE);
-
- DoMethod(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIM_List_Clear);
-
- RebuildMIMETypes();
-
- // Update the MIME Prefs list gadget
-
- DoMethod(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIM_List_Insert, MIMETypes, -1, MUIV_List_Insert_Bottom);
-
- // Update the cycle gadgets
-
- if (DoMethod(Gadgets[GID_TYPE_GROUP_P1], MUIM_Group_InitChange))
- {
- DoMethod(Gadgets[GID_TYPE_GROUP_P1], OM_REMMEMBER, Gadgets[GID_TYPE_CYCLE_P1]);
- MUI_DisposeObject(Gadgets[GID_TYPE_CYCLE_P1]);
-
- DoMethod(Gadgets[GID_TYPE_GROUP_P1], OM_ADDMEMBER, Gadgets[GID_TYPE_CYCLE_P1] = CycleObject, MUIA_Cycle_Entries, MIMETypes, End);
-
- DoMethod(Gadgets[GID_TYPE_GROUP_P1], MUIM_Group_ExitChange);
- } /* if */
-
- if (DoMethod(Gadgets[GID_TYPE_GROUP_P3], MUIM_Group_InitChange))
- {
- DoMethod(Gadgets[GID_TYPE_GROUP_P3], OM_REMMEMBER, Gadgets[GID_TYPE_CYCLE_P3]);
- MUI_DisposeObject(Gadgets[GID_TYPE_CYCLE_P3]);
-
- DoMethod(Gadgets[GID_TYPE_GROUP_P3], OM_ADDMEMBER, Gadgets[GID_TYPE_CYCLE_P3] = CycleObject, MUIA_Cycle_Entries, MIMETypes, End);
-
- DoMethod(Gadgets[GID_TYPE_GROUP_P3], MUIM_Group_ExitChange);
- } /* if */
-
- if (DoMethod(Gadgets[GID_TYPE_GROUP_P4], MUIM_Group_InitChange))
- {
- DoMethod(Gadgets[GID_TYPE_GROUP_P4], OM_REMMEMBER, Gadgets[GID_TYPE_CYCLE_P4]);
- MUI_DisposeObject(Gadgets[GID_TYPE_CYCLE_P4]);
-
- DoMethod(Gadgets[GID_TYPE_GROUP_P4], OM_ADDMEMBER, Gadgets[GID_TYPE_CYCLE_P4] = CycleObject, MUIA_Cycle_Entries, MIMETypes, End);
-
- DoMethod(Gadgets[GID_TYPE_GROUP_P4], MUIM_Group_ExitChange);
- } /* if */
-
- // Save the prefs to ENV:MPackMUI.prefs
-
- SavePrefs("ENV:MPackMUI.prefs");
-
- // Wake up the main window
-
- set(Windows[WID_MAIN], MUIA_Window_Sleep, FALSE);
-
- return(0);
- } /* PrefsUseButtonFunc() */
-
- // --------------------------------------------------------------------------------------------------------------
-
- __saveds LONG PrefsCancelButtonFunc(register __a0 struct Hook *hook, register __a2 APTR obj, register __a1 APTR param)
- {
- // MIME Prefs Window: Cancel Button Gadget
-
- // Revert to old preferences
-
- // Close the window, clear the list and insert all entries from the MIME types array
-
- set(Windows[WID_MIMEPREFS], MUIA_Window_Open, FALSE);
-
- DoMethod(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIM_List_Clear);
- DoMethod(Gadgets[GID_MIMETYPES_LIST_PREFS], MUIM_List_Insert, MIMETypes, -1, MUIV_List_Insert_Bottom);
-
- // Rebuild the MIME types list from the MIME types array
-
- RebuildMIMEList();
-
- // Wake up the main window
-
- set(Windows[WID_MAIN], MUIA_Window_Sleep, FALSE);
-
- return(0);
- } /* PrefsCancelButtonFunc() */
-
- // --------------------------------------------------------------------------------------------------------------
-
- // Hooks
-
- struct Hook MenuAboutHook = { {NULL, NULL}, (HOOKFUNC)MenuAboutFunc, NULL, NULL };
- struct Hook MenuMIMEPrefsHook = { {NULL, NULL}, (HOOKFUNC)MenuMIMEPrefsFunc, NULL, NULL };
- struct Hook MenuResetPrefsHook = { {NULL, NULL}, (HOOKFUNC)MenuResetPrefsFunc, NULL, NULL };
- struct Hook MenuLastSavedPrefsHook = { {NULL, NULL}, (HOOKFUNC)MenuLastSavedPrefsFunc, NULL, NULL };
- struct Hook MenuRestorePrefsHook = { {NULL, NULL}, (HOOKFUNC)MenuRestorePrefsFunc, NULL, NULL };
- struct Hook MenuImportAwebPrefsHook = { {NULL, NULL}, (HOOKFUNC)MenuImportAwebPrefsFunc, NULL, NULL };
- struct Hook MenuImportVoyagerPrefsHook = { {NULL, NULL}, (HOOKFUNC)MenuImportVoyagerPrefsFunc, NULL, NULL };
- struct Hook Page1InputPopHook = { {NULL, NULL}, (HOOKFUNC)Page1InputPopFunc, NULL, NULL };
- struct Hook Page1OutputPopHook = { {NULL, NULL}, (HOOKFUNC)Page1OutputPopFunc, NULL, NULL };
- struct Hook Page1DescPopHook = { {NULL, NULL}, (HOOKFUNC)Page1DescPopFunc, NULL, NULL };
- struct Hook Page1DescCheckHook = { {NULL, NULL}, (HOOKFUNC)Page1DescCheckFunc, NULL, NULL };
- struct Hook Page1MaxCheckHook = { {NULL, NULL}, (HOOKFUNC)Page1MaxCheckFunc, NULL, NULL };
- struct Hook Page1EncodeButtonHook = { {NULL, NULL}, (HOOKFUNC)Page1EncodeButtonFunc, NULL, NULL };
- struct Hook Page2InputPopHook = { {NULL, NULL}, (HOOKFUNC)Page2InputPopFunc, NULL, NULL };
- struct Hook Page2OutputPopHook = { {NULL, NULL}, (HOOKFUNC)Page2OutputPopFunc, NULL, NULL };
- struct Hook Page2DecodeButtonHook = { {NULL, NULL}, (HOOKFUNC)Page2DecodeButtonFunc, NULL, NULL };
- struct Hook Page3InputPopHook = { {NULL, NULL}, (HOOKFUNC)Page3InputPopFunc, NULL, NULL };
- struct Hook Page3DescPopHook = { {NULL, NULL}, (HOOKFUNC)Page3DescPopFunc, NULL, NULL };
- struct Hook Page3DescCheckHook = { {NULL, NULL}, (HOOKFUNC)Page3DescCheckFunc, NULL, NULL };
- struct Hook Page3MaxCheckHook = { {NULL, NULL}, (HOOKFUNC)Page3MaxCheckFunc, NULL, NULL };
- struct Hook Page3EncodeButtonHook = { {NULL, NULL}, (HOOKFUNC)Page3EncodeButtonFunc, NULL, NULL };
- struct Hook Page4InputPopHook = { {NULL, NULL}, (HOOKFUNC)Page4InputPopFunc, NULL, NULL };
- struct Hook Page4DescPopHook = { {NULL, NULL}, (HOOKFUNC)Page4DescPopFunc, NULL, NULL };
- struct Hook Page4DescCheckHook = { {NULL, NULL}, (HOOKFUNC)Page4DescCheckFunc, NULL, NULL };
- struct Hook Page4MaxCheckHook = { {NULL, NULL}, (HOOKFUNC)Page4MaxCheckFunc, NULL, NULL };
- struct Hook Page4EncodeButtonHook = { {NULL, NULL}, (HOOKFUNC)Page4EncodeButtonFunc, NULL, NULL };
- struct Hook PrefsMIMEListHook = { {NULL, NULL}, (HOOKFUNC)PrefsMIMEListFunc, NULL, NULL };
- struct Hook PrefsMIMEUpdateHook = { {NULL, NULL}, (HOOKFUNC)PrefsMIMEUpdateFunc, NULL, NULL };
- struct Hook PrefsAddButtonHook = { {NULL, NULL}, (HOOKFUNC)PrefsAddButtonFunc, NULL, NULL };
- struct Hook PrefsRemoveButtonHook = { {NULL, NULL}, (HOOKFUNC)PrefsRemoveButtonFunc, NULL, NULL };
- struct Hook PrefsCopyButtonHook = { {NULL, NULL}, (HOOKFUNC)PrefsCopyButtonFunc, NULL, NULL };
- struct Hook PrefsSortButtonHook = { {NULL, NULL}, (HOOKFUNC)PrefsSortButtonFunc, NULL, NULL };
- struct Hook PrefsSaveButtonHook = { {NULL, NULL}, (HOOKFUNC)PrefsSaveButtonFunc, NULL, NULL };
- struct Hook PrefsUseButtonHook = { {NULL, NULL}, (HOOKFUNC)PrefsUseButtonFunc, NULL, NULL };
- struct Hook PrefsCancelButtonHook = { {NULL, NULL}, (HOOKFUNC)PrefsCancelButtonFunc, NULL, NULL };
-
- // --------------------------------------------------------------------------------------------------------------
-
- // End Of Text
-